//这个是提示几条信息需要补充
import React from 'react';
import PropTypes from 'prop-types';
import warn from '../../../../assets/busi/reportingServices/manBankReport/warn.png';
import { SearchOutlined } from '@ant-design/icons';
import { Tooltip, message } from 'antd';
import styles from './index.less';
class TipsInfo extends React.Component {
  static defaultProps = {
    count: 0,
    handleClick: () => {},
  };
  state = {
    flag: false,
  };
  search = () => {
    if (this.props.disabledFlag && this.props.disabledFlag > 1) {
      if (this.props.type == 'bond' && this.props.disabledFlag == '2') {
        message.warning('请点击与资讯不一致提示语句，取消查询后重试！');
        return;
      }
      if (this.props.type != 'bond' && this.props.disabledFlag == '3') {
        message.warning('请点击债券无评级提示语句，取消查询后重试！');
        return;
      }
    }
    this.setState(
      {
        flag: !this.state.flag,
      },
      () => {
        this.props.handleClick(this.state.flag);
      },
    );
  };
  render() {
    return (
      <div className={styles.infos}>
        <Tooltip title={this.props.type != 'bond' ? '点击可查询与资讯不一致数据，再次点击取消查询' : '点击可查询无评级数据，再次点击取消查询'}>
          <div className={styles.searchBtn} onClick={this.search}>
            {this.state.flag ? <SearchOutlined style={{ lineHeight: '19px' }} /> : <img src={warn} style={{ height: '14px' }} />}
            <span className={styles.textInfo}>{this.props.type == 'bond' ? `您有${this.props.count}条债券无评级` : `您有${this.props.count}条数据与资讯不一致`}</span>
          </div>
        </Tooltip>
      </div>
    );
  }
}
TipsInfo.propsTypes = {
  count: PropTypes.number,
};
export default TipsInfo;
